//
//  HTTPRequestHelper.h
//  eBook
//
//  Created by Pham Vu Duong on 5/07/12.
//  Copyright 2012 CMC Software Sotusion Company Ltd. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ASIHTTPRequest.h"

#define kRequestListCategoriesNotification @"kRequestListCategoriesNotification"
#define kRequestListItemsNotification @"kRequestListItemsNotification"
#define kHTTPRequestFailedNotification @"kHTTPRequestFailedNotification"
#define kRequestToSignUpNotification @"kRequestToSignUpNotification"
#define kRequestToLogInNotification @"kRequestToLogInNotification"
#define kRequestChangePasswordNotification @"kRequestChangePasswordNotification"

typedef enum
{
    REQUEST_CATEGORY_LIST,
    REQUEST_ITEM_LIST, 
    REQUEST_SIGNUP, 
    REQUEST_LOGIN, 
    REQUEST_CHANGE_PASSWORD
} HTTPRequestMethod;

@interface HTTPRequestHelper : NSObject <ASIHTTPRequestDelegate>
{
    HTTPRequestMethod httpRequestMethod;
    ASIHTTPRequest * _request;
}

@property (nonatomic, assign) HTTPRequestMethod httpRequestMethod;
@property (nonatomic, copy) NSString * notificationReturn;

- (void)requestWithMethodName:(HTTPRequestMethod)methodName
                       andURL:(NSString*)URL
                andHttpMethod:(NSString *)httpMethod
                  andDelegate:(id<ASIHTTPRequestDelegate>)delegate;
- (void)dismissRequest;

#pragma mark - Get Records from Back-end Database

- (NSString*)getListCategories;
- (NSString *)getListCategoriesWithTokenKey:(NSString*)tokenKey;

- (NSString*)getListCategoriesWithTokenKey:(NSString*)tokenKey AndCondition:(NSString*)conditionString;

- (NSString*)getListItems;
- (NSString*)getListItemsWithTokenKey:(NSString*)tokenKey;

- (NSString*)getListItemsWithTokenKey:(NSString*)tokenKey AndCondition:(NSString*)conditionString;

- (NSString*)getListCategoriesWithTokenKey:(NSString*)tokenKey AndVersionLargerThan:(int)versionValue
;

- (NSString*)getListItemsWithTokenKey:(NSString*)tokenKey AndVersionLargerThan:(int)versionValue;
- (NSString*)getListItemsWithTokenKey:(NSString*)tokenKey ByType:(NSString*)type AndVersionLargerThan:(int)versionValue;

- (NSString*)requestToSignUpWithUserName:(NSString*)userName AndPassword:(NSString*)password AndTokenKey:(NSString*)tokenKey;
- (NSString*)requestToLogInWithUserName:(NSString*)userName AndPassword:(NSString*)password AndTokenKey:(NSString*)tokenKey;

- (NSString*)requestChangePassword:(NSString*)userName AndPassword:(NSString*)password WithNewPassword:(NSString*)newPassword AndTokenKey:(NSString*)tokenKey;

@end
